# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test02
# Description:  例8.2
# Author:       ASUS
# Date:         2019/3/11
#-------------------------------------------------------------------------------


class MyClass:
    def getName(self):
        return self.name
    def setName(self,name):
        self.name = name
        #类的内部可以直接调用私有方法
        self.__outName()
    def __outName(self):
        print('Name = {}'.format(self.name))

myClass = MyClass()
# 获取MyClass类中所有的方法
import inspect
methods = inspect.getmembers(myClass,predicate=inspect.ismethod)
print(methods)
for method in methods:
    print(method[0])
print("-------------------------------------------------")
myClass.setName("Bill")
print(myClass.getName())
# 方法"__outName"改名为"_MyClass__outName"
myClass._MyClass__outName()
# myClass.__outName()




